package com.dex4d.ui.main.model;

import android.os.Parcel;
import android.os.Parcelable;

import java.util.List;

/**
 * 作者    LiQingyi
 * 时间    2018/10/31 14:04
 * 文件    dex4d-android
 * 描述
 */
public class HomeModel implements Parcelable {
   public int type;
   public TokenDetail token;

   public String totalCapital;
   public String totalTokenBalance;
   public String totalDex4DBalance;

   public List<TokenDetail> tokenDetailList;

   public HomeModel(int type) {
      this.type = type;
   }

   public HomeModel(int type, TokenDetail token) {
      this.type = type;
      this.token = token;
   }

   public HomeModel() {
   }

   @Override
   public int describeContents() {
      return 0;
   }

   @Override
   public void writeToParcel(Parcel dest, int flags) {
      dest.writeInt(this.type);
      dest.writeParcelable(this.token, flags);
      dest.writeString(this.totalCapital);
      dest.writeString(this.totalTokenBalance);
      dest.writeString(this.totalDex4DBalance);
      dest.writeTypedList(this.tokenDetailList);
   }

   protected HomeModel(Parcel in) {
      this.type = in.readInt();
      this.token = in.readParcelable(TokenDetail.class.getClassLoader());
      this.totalCapital = in.readString();
      this.totalTokenBalance = in.readString();
      this.totalDex4DBalance = in.readString();
      this.tokenDetailList = in.createTypedArrayList(TokenDetail.CREATOR);
   }

   public static final Creator<HomeModel> CREATOR = new Creator<HomeModel>() {
      @Override
      public HomeModel createFromParcel(Parcel source) {
         return new HomeModel(source);
      }

      @Override
      public HomeModel[] newArray(int size) {
         return new HomeModel[size];
      }
   };
}
